const commentService = require("../service/comment.service")

class commentController {
    async created(ctx) {
        const { id } = ctx.user
        const { momentId, content } = ctx.request.body
        // console.log(id, content, momentId)
        const result = await commentService.created(content, momentId, id)
        ctx.body = {
            code: 0,
            message: '评论成功',
            data: result
        }
    }
    async reply(ctx) {
        const { id } = ctx.user
        const { momentId, content, commentId } = ctx.request.body
        // console.log(id, content, momentId, commentId)
        const result = await commentService.reply(content, momentId, id, commentId)
        ctx.body = {
            code: 0,
            message: '评论成功',
            data: result
        }
    }
}
module.exports = new commentController